net/http/httputil: fix leaks and data loss in ReverseProxy protocol upgrade - #80924
net/http/httputil: fix leaks and data loss in ReverseProxy protocol upgrade#80924wentaoxu-boop wants to merge 1 commit into
Conversation
…pgrade In handleUpgradeResponse: - Close res.Body on early validation errors and when hijacking fails to prevent leaking backend connections and file descriptors. - Strip hop-by-hop headers from backend 101 Switching Protocols responses while preserving Connection and Upgrade headers. - Read from the Hijacker's bufio.Reader when copying data to the backend to avoid losing client data buffered during or immediately after the handshake. - Increase error channel buffer capacity to 2 to ensure neither copy goroutine blocks on channel send when exiting early on error. Fixes golang#80875
|
This PR (HEAD: 7fa5d2c) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/816640. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/816640. |
In handleUpgradeResponse:
prevent leaking backend connections and file descriptors.
responses while preserving Connection and Upgrade headers.
backend to avoid losing client data buffered during or immediately
after the handshake.
goroutine blocks on channel send when exiting early on error.
Fixes #80875